package com.gserver.commons.astar;


//节点类
public class Node implements Comparable<Node>
{

     private int  x;         // X坐标
     private int  y;         // Y坐标
     private Node parentNode; // 父类节点
     private int  g;         // 当前点到起点的移动耗费
     private int  h;         // 当前点到终点的移动耗费，即曼哈顿距离|x1-x2|+|y1-y2|(忽略障碍物)
     private int  f;         // f=g+h


     public Node(int x, int y)
     {
          this.x = x;
          this.y = y;
     }
     
     public Node(int x, int y, Node parentNode)
     {
          this.x = x;
          this.y = y;
          this.parentNode = parentNode;
     }

     public int getX()
     {
          return x;
     }

     public void setX(int x)
     {
          this.x = x;
     }

     public int getY()
     {
          return y;
     }

     public void setY(int y)
     {
          this.y = y;
     }

     public Node getParentNode()
     {
          return parentNode;
     }

     public void setParentNode(Node parentNode)
     {
          this.parentNode = parentNode;
     }

     public int getG()
     {
          return g;
     }

     public void setG(int g)
     {
          this.g = g;
     }

     public int getH()
     {
          return h;
     }

     public void setH(int h)
     {
          this.h = h;
     }

     public int getF()
     {
          return f;
     }

     public void setF(int f)
     {
          this.f = f;
     }

     public int compareTo(Node o)
     {
          return f - o.f;
     }

}
